package acm.第二轮;

import java.util.Scanner;

public class H {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] arr=new int[sc.nextInt()];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=sc.nextInt();
        }
        int count=0;
        for (int i = 1; i < arr.length; i++) {
            for (int j = 0; j < i; j++) {
                count+=arr[i]<arr[j]?1:0;
            }
        }
        System.out.println(count);
    }
}
